package com.yuerlive.paperplane;

import android.app.Application;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatDelegate;

import com.yuerlive.paperplane.utils.PreferenceUtils;

/**
 * Created by Admin on 2017/7/3.
 */

public class PaperPlanApp extends Application {
    private static PaperPlanApp app;
    private boolean isNight;
    @Override
    public void onCreate() {
        super.onCreate();
        app=this;
        isNight = PreferenceUtils.getPreferences().getBoolean("night", false);
        if (isNight) {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
            PreferenceUtils.putBoolean("night", false);
        } else {
            AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
            PreferenceUtils.putBoolean("night", true);
        }
    }
    public static PaperPlanApp getContent(){
        return  app;
    }
}
